package com.example.newfragemnt;

/**
 * Created by 青阳 on 2018/11/1.
 */
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
//用来显示新闻内容的fragment
public class NewContentFragment extends Fragment {
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        //得到当前fragment的视图
        View view = inflater.inflate(R.layout.fg_content,null);
        //得到当前fragment的TextView用来显示新闻内容
        TextView textContentView = view.findViewById(R.id.tvcontent);
        //要往这个TextView 里面放值，新闻内容

        //通过Argument得到绑定的值
        textContentView.setText(getArguments().getString("content"));
        return view;
    }
}

